package com.hsc.yalebao.tabChongZhi;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.PayResultBean;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tabMine.QianBaoActivity;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import okhttp3.Call;

public class PayResultActivity extends BaseActivity
  implements View.OnClickListener
{
  private String TAG = "PayResultActivity";
  private ImageView btn_back_home;
  private ImageView btn_check_wallte;
  private Context context;
  int fiveSecond = 6;
  private TimerTask fiveSecondTimerTask;
  private Handler handler = new Handler()
  {
    public void handleMessage(Message paramAnonymousMessage)
    {
      switch (paramAnonymousMessage.what)
      {
      default:
      case 0:
      }
      do
      {
        return;
        PayResultActivity localPayResultActivity = PayResultActivity.this;
        localPayResultActivity.fiveSecond = (-1 + localPayResultActivity.fiveSecond);
        LogUtils.e(PayResultActivity.this.TAG, "fiveSecond:" + PayResultActivity.this.fiveSecond);
        if (PayResultActivity.this.fiveSecond == 0)
        {
          PayResultActivity.this.fiveSecond = 0;
          PayResultActivity.this.fiveSecondTimerTask.cancel();
          PayResultActivity.this.tv_pay_result.setText("正在刷新...");
          PayResultActivity.this.getPayResult();
          return;
        }
      }
      while (PayResultActivity.this.fiveSecond == 0);
      PayResultActivity.this.tv_pay_result.setText("充值中...(" + PayResultActivity.this.fiveSecond + "s后刷新)");
    }
  };
  private boolean isPayScuessed = false;
  private ImageView iv_title_right;
  private int memberid;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      case 2131099704:
      default:
        return;
      case 2131099699:
      }
      CustomApplication.app.finishActivity(PayResultActivity.this);
    }
  };
  String payNo = "";
  private Timer timer = new Timer();
  private TextView tv_pay_result;
  private View view_title;

  private void getPayResult()
  {
    if (CustomApplication.app.userBaseBean != null)
      this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    HashMap localHashMap = new HashMap();
    localHashMap.put("memberid", this.memberid);
    localHashMap.put("orderid", this.payNo);
    LogUtils.d(this.TAG, "订单号orderid:" + this.payNo);
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_RECHARGE_STATUS);
    RequestNet.get(this.context, AppConstants.URL_GET_RECHARGE_STATUS, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        LogUtils.e(PayResultActivity.this.TAG, "获取失败,getPlaytList-result:" + paramAnonymousException);
        PayResultActivity.this.isPayScuessed = false;
      }

      public void onResponse(String paramAnonymousString)
      {
        LogUtils.d(PayResultActivity.this.TAG, "result:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
        {
          LogUtils.d(PayResultActivity.this.TAG, "result为空");
          PayResultActivity.this.isPayScuessed = false;
        }
        do
        {
          PayResultBean localPayResultBean;
          do
          {
            return;
            Gson localGson = new Gson();
            try
            {
              localPayResultBean = (PayResultBean)localGson.fromJson(paramAnonymousString, PayResultBean.class);
              if (localPayResultBean == null)
              {
                LogUtils.e(PayResultActivity.this.TAG, "获取失败");
                return;
              }
            }
            catch (Exception localException)
            {
              while (true)
              {
                localException.printStackTrace();
                localPayResultBean = null;
              }
              if (localPayResultBean.getFlag() == -4)
              {
                PayResultActivity.activityStack.backToMain(MainActivity.class, PayResultActivity.this.context);
                return;
              }
              if (localPayResultBean.getFlag() == 0)
              {
                PayResultActivity.this.fiveSecond = 6;
                if (PayResultActivity.this.timer != null)
                {
                  PayResultActivity.this.fiveSecondTimerTask = new PayResultActivity.FiveSecondTimerTask(PayResultActivity.this);
                  PayResultActivity.this.timer.schedule(PayResultActivity.this.fiveSecondTimerTask, 1000L, 1000L);
                }
                PayResultActivity.this.isPayScuessed = false;
                return;
              }
              if (localPayResultBean.getFlag() == -2)
              {
                PayResultActivity.this.showDownWireDialog();
                return;
              }
              if (localPayResultBean.getFlag() == -3)
              {
                PayResultActivity.this.ShowFengjinDialog();
                return;
              }
            }
          }
          while (localPayResultBean.getFlag() != 1);
          PayResultActivity.this.isPayScuessed = true;
          localPayResultBean.getResult();
          PayResultActivity.this.tv_pay_result.setText(localPayResultBean.getMsg());
        }
        while (PayResultActivity.this.fiveSecondTimerTask == null);
        PayResultActivity.this.fiveSecondTimerTask.cancel();
      }
    });
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
  }

  public void onClick(View paramView)
  {
    switch (paramView.getId())
    {
    default:
    case 2131099916:
    case 2131099917:
    }
    do
    {
      return;
      MainActivity.mainActivity.performClickBtn(0);
      CustomApplication.app.finishActivity(this);
      return;
      startActivityForResult(new Intent(this, QianBaoActivity.class), 0);
    }
    while (!this.isPayScuessed);
    CustomApplication.app.finishActivity(this);
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903073);
    CustomApplication.app.addActivity(this);
    this.context = this;
    this.tv_pay_result = ((TextView)findViewById(2131099915));
    this.btn_back_home = ((ImageView)findViewById(2131099916));
    this.btn_check_wallte = ((ImageView)findViewById(2131099917));
    this.btn_back_home.setOnClickListener(this);
    this.btn_check_wallte.setOnClickListener(this);
    setTitle(8, 0, 2130837809, "充值状态", 0, 8, 8, 0, true);
    this.payNo = getIntent().getStringExtra("payNo");
    getPayResult();
  }

  protected void onDestroy()
  {
    super.onDestroy();
    if (this.timer != null)
    {
      this.timer.cancel();
      this.timer = null;
    }
    if (this.fiveSecondTimerTask != null)
    {
      this.fiveSecondTimerTask.cancel();
      this.fiveSecondTimerTask = null;
    }
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      ((TextView)localView.findViewById(2131099701)).setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView = (TextView)localView.findViewById(2131099702);
      localTextView.setVisibility(paramInt5);
      localTextView.setOnClickListener(this.onClickListener);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }

  class FiveSecondTimerTask extends TimerTask
  {
    FiveSecondTimerTask()
    {
    }

    public void run()
    {
      PayResultActivity.this.handler.sendEmptyMessage(0);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabChongZhi.PayResultActivity
 * JD-Core Version:    0.6.2
 */